package com.item.mall.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebAppConfiguration implements WebMvcConfigurer {

    //定制资源映射
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //意思是：url中读取到/profilePhoto，就会自动将/profilePhoto解析成D:/idea/java_workspace/image/upload
        registry.addResourceHandler("/profilePhoto/**").addResourceLocations("file:F:\\idealprojects\\mall\\src\\main\\resources\\static\\images\\profilePhoto\\");
    }
}
